package com.tedu.controller;

import com.tedu.service.EmpService;
import com.tedu.service.impl.EmpServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Author：毕龙
 * Date: 2023/7/29 9:24
 */
@WebServlet("/emp/delete")
public class EmpDeleteController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1.处理请求
        String id = request.getParameter("id");
        //2.调用业务逻辑
        EmpService service = new EmpServiceImpl();
        service.deleteEmpById(id);

        //3.跳转
        response.sendRedirect(request.getContextPath()+"/emp/findAll");
    }
}
